#!/usr/bin/python3.8.9
# -*- coding: utf-8 -*-

# @Author  : Tina Yu
# @Time    : 2021-9-6 14:57
import json

import requests


class BaseApi:
    """一些底层基础方法的封装类"""

    def request(self, request: dict):
        if "url" in request:
            return self.http_request(request)

    def http_request(self, request):
        # request = {
        #     'protocal':"http",
        #     'url': "",
        #     'method': "get",
        #     'json': {},
        #     'params': {},
        # }
        r = requests.request(**request)
        print(json.dumps(r.json(), indent=4, ensure_ascii=False))
        return r

    def rpc_request(self):
        pass

    def tcp_request(self):
        pass
